import java.util.Arrays;

public class Main {
    public static void main(String[] args) {
        int[] array={2,7,11,8,4};
        int n=12;
        func(array,n);
        System.out.println(Arrays.toString(func(array,n)));
    }
    public static int[] func(int[] arr,int x){
        int[] array1=new int[2];
        for (int i = 0; i < arr.length-1; i++) {
            for (int j = i+1; j <= arr.length-1; j++) {
                if(arr[i]+arr[j]==x){
                    array1[0]=i;
                    array1[1]=j;
                    return array1;
                }
            }
        }
        return array1;
    }
}